/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {Text, View, Image} from 'react-native';

import {CachedImageBackground} from "react-native-img-cache";

import styles from '../../style/program';

export default class VarietyDetail extends Component {
  constructor(props) {
    super(props);
  }
  render() {
    var data = this.props.program;
    return (
      <View style={styles.info}>
        <View style={styles.infoB}>
        {data.mainPicPath?
          <CachedImageBackground source={{uri:data.mainPicPath}} style={styles.infoPic}>
            <View style={[styles.imgBorder,{borderRightWidth:0,alignItems:'flex-end'}]}>
              <View style={styles.imgPoint}></View>
              <View style={styles.imgPoint}></View>
            </View>
            <View style={[styles.imgBorder,{borderLeftWidth:0,alignItems:'flex-start'}]}>
              <View style={styles.imgPoint}></View>
              <View style={styles.imgPoint}></View>
            </View>
          </CachedImageBackground>:
          <View style={[styles.infoPic,styles.noImgBorder]}>
            <Text style={styles.noImgText}>暂无图片</Text>
          </View>
        }
        </View>
        <View style={styles.infoT}>
          <Text style={styles.infoTitle} numberOfLines={1}>{data.title}</Text>
          <View style={styles.programTypeList}>
          {data.programTypeList && data.programTypeList.length?
            data.programTypeList.map((val,idx) => {
              return (<View key={idx} style={styles.programTypeW}><Text style={styles.programType}>{val.title}</Text></View>)
            }):null
          }
          </View>

          <View style={styles.programL}>
            {
              data.onlineDate?<Text style={styles.programone}>{data.onlineDate}上映</Text>:null
            }
            {
              data.playPlatformList && data.playPlatformList.length?
              <View style={styles.programPlatform}>
                <Text style={styles.programone}>播出平台 {
                  data.playPlatformList.length > 1?data.playPlatformList[0].title+"等":data.playPlatformList[0].title
                }
                </Text>
              </View>:null
            }
            {
              data.enterpriseList && data.enterpriseList.length?
              <View style={styles.programPlatform}>
                <Text style={styles.programone}>制作机构 {
                  data.enterpriseList.length > 1? data.enterpriseList[0].title+"等":data.enterpriseList[0].title
                }
                </Text>
              </View>:null
            }
            {
              data.mainActor?<Text style={styles.programone} numberOfLines={2}>主持人 {data.mainActor}</Text>:null
            }
            {
              data.director?<Text style={styles.programone} numberOfLines={2}>导演 {data.director}</Text>:null
            }
            {
              data.producer?<Text style={styles.programone} numberOfLines={2}>制片人 {data.producer}</Text>:null
            }
            {
              data.timeStr?<Text style={styles.programone} numberOfLines={2}>片长 {data.timeStr}</Text>:null
            }
          </View>
        </View>
      </View>
    );
  }
}